<?php
include '../newlib.php';

$id = $_REQUEST['id'];
$new = $_REQUEST['new'];

$van = asDatabaseDate($_REQUEST['van']);
$tot = asDatabaseDate($_REQUEST['tot']);

$sql = "update narrowbase.schema set van=:van, tot=:tot, ma=:ma, di=:di, wo=:wo, do=:do, vr=:vr, za=:za, zo=:zo where schemaid=:schemaid";
$stm = $tmpConnection->prepare($sql);
$value = $stm->execute(array(
	':van' => $van,
	':tot' => $tot,
	':ma' => isset($_REQUEST['ma']),
	':di' => isset($_REQUEST['di']),
	':wo' => isset($_REQUEST['wo']),
	':do' => isset($_REQUEST['do']),
	':vr' => isset($_REQUEST['vr']),
	':za' => isset($_REQUEST['za']),
	':zo' => isset($_REQUEST['zo']),
	':schemaid' => $id
	));

$msg = "";
if ($new === 'true') {
	$msg="window.opener.document.location.reload();";
}
echo <<<EOD
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
	$msg   
    window.close();
</SCRIPT>
EOD;

?>
